package com.parsley.control
{
	import com.parsley.message.DelUserMessage;
	import com.parsley.model.UserPM;
	import com.parsley.service.DelUserService;
	
	import flash.events.EventDispatcher;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.Fault;
	
	import org.spicefactory.lib.logging.LogContext;
	import org.spicefactory.lib.logging.Logger;
	
	public class DelUserCommand extends EventDispatcher
	{
		
		[Inject]
		public var delUserService:DelUserService;
		
		private static const logger:Logger = LogContext.getLogger( SaveUserCommand );
		
		public function execute( message:DelUserMessage ):AsyncToken
		{
			return delUserService.send(message);
		}
		
		public function result( user:UserPM ):void
		{
			trace(user);
		}
		
		public function error( fault:Fault ):void
		{
			logger.error( "save user service call failed: " + fault.message );
		}

	}
}